package com.xiaoqing.framework.core.handler;

import com.xiaoqing.framework.common.exception.BizException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author: <a href="get_xiaobo@163.com">Josh_Xu</a>
 * @description: 全局异常捕获
 * @create: 2020-06-19 23:45
 **/
@RestControllerAdvice
public class ApplicationExceptionHandler {

    @ExceptionHandler(value = BizException.class)
    public ResponseEntity bizException(BizException e) {
        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("服务异常");
    }


}
